package org.example.stream;

import java.util.ArrayList;
import java.util.Collections;

public class Demo05 {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        Collections.addAll(list,"1","2","3");
//        list.stream().map(new Function<String, Integer>() {
//            @Override
//            public Integer apply(String s) {
//                return Integer.parseInt(s);
//            }
//        }).forEach(s-> System.out.println(s.getClass() + " " + s));
 
        //用lambda表达式后
        list.stream()
                .map(s -> Integer.parseInt(s))
                .forEach(s-> System.out.println(s.getClass() + " " + s));
    }
}
